home *** CD-ROM | disk | FTP | other *** search
- //Copy a document file to the STalker terminal window. Modified by Scott
- //Dowdle and Bob Morrow to allow for pauses in the scrolling. The
- //original version would simply scroll on to the end of the file.
-
-
- function show_file(string file)
- string buffer[256];
- int fd;
- int linecount;
- int whatnow;
-
- if (fd = file_open(file, 0)) < 0 then
- printf("Error %d opening '%s'\r\n", fd, file);
- return;
- endif
-
- linecount = 0;
-
- while file_gets(buffer, sizeof(buffer), fd) > 0 do
- linecount = linecount + 1;
- if (linecount == 19) then //Change this to 20 if you don't use
- //the horizontal scroll bar in STalker.
- printf("---More? [Q to quit] ---\r\n");
- whatnow = getchar();
- if (whatnow == 113) then
- //113 = Decimal value for q. Change that to 81
- //if you want to use Q (CAPS). Change that to
- //120 if you want to use x. Don't forget to
- //change line 23 as well!
- file_close(fd);
- return;
- endif
- linecount = 0;
- endif
- puts(buffer);
- endwhile
- file_close(fd);
-
- endfunction
-
-
- function main()
- string source_file[14];
- string source_full[128];
- string source_path[128];
-
- source_path[0] = file_get_drive();
- source_path[1] = ':';
- file_get_dir(0, source_path + 2);
- strcat(source_path, "\\*.DOC"); //You can change it to *.* or
- //whatever.
- source_file[0] = 0;
-
- while fsel(source_path,source_file,source_full,"File to Display?")do
- if source_file[0] == 0 then
- return;
- endif
-
- show_file(source_full);
- endwhile
- endfunction
-